# Add any other variables to grab here:
other_merge_variables <- c("id","resample","compliance_label","parent",
													 "randomdraw6","randomdraw6_grouped",
													 "abs_passive_option_lc1","abs_passive_option_bring_up",
													 "abs_passive_option_pta","abs_passive_option_assemble")

ml_tomerge <- ml[,c(other_merge_variables,covariates,absenteeism_outcomes, vaw_outcomes, abo_outcomes)]

names(ml_tomerge) <- paste0(names(ml_tomerge),"_ml")
ml_tomerge$merge_id <- ml_tomerge$id_ml
ml_tomerge$resample <- ml_tomerge$resample_ml

el$merge_id <- NA


# Now merging in compliers only: 

el$merge_id[el$respondent_category == "Complier"] <- el$id[el$respondent_category == "Complier"]

el <- merge(x = el,ml_tomerge,by = "merge_id",all.x = T)

el$resample[is.na(el$resample)] <- 0



rm(ml_tomerge)



































